package com.cloud.mall.test.client.impl;

import com.cloud.mall.test.client.OrderClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Service;

/**
 * @Author: 梁二东
 * @Date: 2024/12/4 14:36
 * @Description:
 **/
@Service
@Slf4j
public class OrderClientImpl implements FallbackFactory<OrderClient> {

    @Override
    public OrderClient create(Throwable cause) {
        return new OrderClient() {

            @Override
            public String hello(String name) {
                log.error("触发order-service服务熔断降级，原因：" + cause.getMessage());
                return name;
            }
        };
    }
}
